package archforce.atp.x.ui.impl.left;

import com.alibaba.fastjson.JSON;

import java.io.Serializable;

/**
 * @author wx
 * @version 1.0
 * @date 2022/4/8 11:28
 */
public class IPPortModel implements Serializable {

    private String ip;
    private Integer port;

    private static final String DEFAULT_IP = "127.0.0.1";
    private static final String DEFAULT_BLANK_IP = "";
    private static final Integer DEFAULT_PORT = 22;
    private static final Integer DEFAULT_BLANK_PORT = null;

    public IPPortModel(boolean blank){
        if(blank){
            this.ip = DEFAULT_BLANK_IP;
            this.port = DEFAULT_BLANK_PORT;
        }else{
            this.ip = DEFAULT_IP;
            this.port = DEFAULT_PORT;
        }
    }

    public IPPortModel(String ip, Integer port) {
        this.ip = ip;
        this.port = port;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this,true);
    }
}
